package com.fsy.entities;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * 
 * @TableName modules
 */
@TableName(value ="modules")
@Data
public class Modules implements Serializable {
    /**
     * 模块编号
     */
    @TableId(value = "Id", type = IdType.AUTO)
    private Integer id;

    /**
     * 模块名称
     */
    @TableField(value = "Name")
    private String name;

    /**
     * 父模块编号
     */
    @TableField(value = "ParentId")
    private Integer parentId;

    /**
     * 模块路径
     */
    @TableField(value = "Path")
    private String path;

    /**
     * 权重
     */
    @TableField(value = "Weight")
    private Integer weight;

    /**
     * 预留字符串字段
     */
    @TableField(value = "Ops")
    private String ops;

    /**
     * 预留整数字段
     */
    @TableField(value = "type")
    private String type;

    /**
     * 添加图标
     */
    @TableField(value = "icon")
    private String icon;

    @TableField(exist = false)  //非数据库字段加
    private int page;

    @TableField(exist = false)  //非数据库字段加
    private int limit;

    @TableField(exist = false)  //非数据库字段加
    private int offset;

    @TableField(exist = false)  //非数据库字段加
    private List<Modules> children;  //当前菜单的子菜单

    @TableField(value = "Name")
    private String title;//菜单的名字

    public void setChecked(Boolean checked) {
        //只要当前的菜单有子菜单，就不勾选
        if(this.children.size() > 0){
            this.checked = false;
        }else{
            this.checked = checked;
        }

    }

    @TableField(exist = false)  //非数据库字段加
    private Boolean checked = false; //菜单树的当前菜单是否勾选
    @TableField(exist = false)  //非数据库字段加
    private Boolean spread = false;//菜单树的当前菜单是否展开

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    /**
     * 模块编号
     */
    public Integer getId() {
        return id;
    }

    /**
     * 模块编号
     */
    public void setId(Integer id) {
        this.id = id;
    }

    /**
     * 模块名称
     */
    public String getName() {
        return name;
    }

    /**
     * 模块名称
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 父模块编号
     */
    public Integer getParentId() {
        return parentId;
    }

    /**
     * 父模块编号
     */
    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }

    /**
     * 模块路径
     */
    public String getPath() {
        return path;
    }

    /**
     * 模块路径
     */
    public void setPath(String path) {
        this.path = path;
    }

    /**
     * 权重
     */
    public Integer getWeight() {
        return weight;
    }

    /**
     * 权重
     */
    public void setWeight(Integer weight) {
        this.weight = weight;
    }

    /**
     * 预留字符串字段
     */
    public String getOps() {
        return ops;
    }

    /**
     * 预留字符串字段
     */
    public void setOps(String ops) {
        this.ops = ops;
    }

}